package com.evon.yardmanagement.dao;

import org.hibernate.Session;

import com.evon.yardmanagement.dao.interceptor.AuditInterceptor;

public class HibernateUtil {
	private static HibernateHelper hibernateHelper;
	 
	   /**
	     * Get the hibernate helper.
	     * @return the helper.
	     */
	   public static synchronized HibernateHelper getHibernateHelper() {
	       if (hibernateHelper == null) {
	           hibernateHelper = new HibernateHelper(null, new AuditInterceptor());
	           hibernateHelper.initialize();
	       }
	       
	       return hibernateHelper;
	   }
	 
	   /**
	     * Get the current session.
	     * @return the session.
	     */
	   public static Session getCurrentSession() {
	       return getHibernateHelper().getCurrentSession();
	   }
}
